﻿@model Template
@{
    IEnumerable<SelectListItem> templates = ViewBag.Templates;
}
<div class="widget-content">
    <div class="widget-box">
        <div class="widget-title">
            <span class="icon"><i class="icon-align-justify"></i></span>
            <h5>
                编辑模版信息</h5>
        </div>
        <div class="widget-content nopadding">
            @if (IsPost)
            { 
                <div class="widget-content" style="border: 0px">
                    @if (ViewBag.Result)
                    {
                        <div class="alert alert-success">
                            <a class="close" data-dismiss="alert" href="#">×</a>
                            <h4 class="alert-heading">
                                保存成功!</h4>
                            您的模版信息已经成功保存,你可以继续添加或者返回列表查看.
                        </div>
                    }
                    else
                    {
                        <div class="alert alert-error">
                            <a class="close" data-dismiss="alert" href="#">×</a>
                            <h4 class="alert-heading">
                                保存失败!</h4>
                            如确认您的数据填写无误,请联系管理员或查看错误日志.
                        </div>
                    }
                </div>
            }
            <form action="@Url.Action("Info", "Template", new { id = @Request.QueryString["id"] })" method="post" class="form-horizontal">
            <div class="control-group">
                <label class="control-label">
                    模版名称:</label>
                <div class="controls">
                    <div class="span6">
                        @Html.DropDownListFor(i => i.Name, templates)
                        <span class="help-block">请选择对应的模版文件</span>
                    </div>
                </div>
            </div>
                @*            <div class="control-group">
                <label class="control-label">
                    保存目录:</label>
                <div class="controls">
                    @Html.TextBoxFor(i => i.Directory, new { @class = "span6" })
                    <span class="help-block">请输入该模版生成的Html文件所保存的目录</span>
                </div>
            </div>          
            <div class="control-group">
                <label class="control-label">
                    模版类型:</label>
                <div class="controls">
                    <div class="span6">
                        @Html.DropDownListFor(i => i.Type, new[]
                                {
                                    new SelectListItem{Text=@"首页类",Value="1"},
                                    new SelectListItem{Text=@"列表类",Value="2"},
                                    new SelectListItem{Text=@"内容类",Value="3"},
                                })
                        <span class="help-block">请选择模版类型</span>
                    </div>
                </div>
            </div>*@
            @Html.HiddenFor(i => i.IsRelease)
            <div class="form-actions">
                <button id="Save" type="submit" class="btn btn-success">
                    @Html.Raw(string.IsNullOrWhiteSpace(Request.QueryString["id"]) ? "确认添加" : "保存编辑")
                </button>
                <a href="@Url.Action("Index", "Template")" class="btn btn-danger">返回列表</a>
            </div>
            </form>
        </div>
    </div>
</div>
